<?php
declare (strict_types = 1);

namespace app\controller;

use app\BaseController;
use app\model\User;
use app\traits\JsonResponse;
use think\facade\Request as RequestFacade;
use app\model\Cat as CatModel;
class Test extends BaseController {
    use JsonResponse;
    protected $middleware = [
        'auth_jwt' => ['only' => ['api']],
    ];
    public function test()
    {
//        $user = new User;
//        $list = [
//            [
//                'name'=>'林黛玉',
//                'email'=>'th'.rand(10000,99999).'@qq.com',
//                'phone'=> '13800000002',
//                'password'=>getSha1Password('123123'),
//                'avatar' =>  RequestFacade::domain().'/fakes/avatars/avatar'.mt_rand(1,7).'.png'
//            ],
//            [
//                'name'=>'薛宝钗',
//                'email'=>'th'.rand(10000,99999).'@qq.com',
//                'phone'=> '13800000003',
//                'password'=>getSha1Password('123123'),
//                'avatar' =>  RequestFacade::domain().'/fakes/avatars/avatar'.mt_rand(1,7).'.png'
//            ],
//            [
//                'name'=>'史湘云',
//                'email'=>'th'.rand(10000,99999).'@qq.com',
//                'phone'=> '13800000004',
//                'password'=>getSha1Password('123123'),
//                'avatar' =>  RequestFacade::domain().'/fakes/avatars/avatar'.mt_rand(1,7).'.png'
//            ],
//            [
//                'name'=>'贾元春',
//                'email'=>'th'.rand(10000,99999).'@qq.com',
//                'phone'=> '13800000005',
//                'password'=>getSha1Password('123123'),
//                'avatar' =>  RequestFacade::domain().'/fakes/avatars/avatar'.mt_rand(1,7).'.png'
//            ],
//            [
//                'name'=>'贾迎春',
//                'email'=>'th'.rand(10000,99999).'@qq.com',
//                'phone'=> '13800000006',
//                'password'=>getSha1Password('123123'),
//                'avatar' =>  RequestFacade::domain().'/fakes/avatars/avatar'.mt_rand(1,7).'.png'
//            ],
//
//        ];
//        $user->saveAll($list);
//        $cat = new CatModel;
//        $list = [
//            ['title'=>'时事要闻'],
//            ['title'=>'人在旅途'],
//            ['title'=>'美食天地'],
//            ['title'=>'动物世界'],
//            ['title'=>'体育达人'],
//            ['title'=>'历史文化'],
//            ['title'=>'学习园地'],
//        ];
//        $cat->saveAll($list);

    }

    public function api(){
        return $this->user_id;
    }
}
